package com.gp.billsrecord.ui.main.adapters

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.viewbinding.ViewBinding
import com.gp.billsrecord.databinding.ItemAccountAdapterBinding
import com.gp.billsrecord.model.data.AccountInfo
import com.gp.billsrecord.base.BasePagingDataAdapter
import com.gp.billsrecord.extensions.toMoney
import com.gp.billsrecord.model.data.AccountType
import com.gp.billsrecord.util.AccountTypes

class AccountAdapter :
    BasePagingDataAdapter<AccountInfo, ItemAccountAdapterBinding>() {

    override fun onBind(binding: ItemAccountAdapterBinding, item: AccountInfo?) {
        item?.also {
            binding.tvAccountBalance.text = item.balance.toMoney()
            binding.tvAccountNumber.text = item.accountNumber
            binding.tvAccountType.text = item.accountTypeName
        }
    }

    override fun createBinding(
        inflate: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): ItemAccountAdapterBinding = ItemAccountAdapterBinding.inflate(inflate, parent, false)
}
